const fs = require('fs');
exports.issetHeader = true;
exports.main = (req,res) =>{
    res.setHeader('Content-Type','application/json');
    const tool = require(req.bind.dir+'/module/emma.js');
    _POST = req.bind.__POST;
    var _dir = req.bind.dir;
    const conf = require(_dir+'/config/config.js');
    var html = '';
    var dir = _dir+'/'+conf.log+'/';
    if(_POST){
        //var post = _POST;
        var str =  JSON.stringify(_POST);
        html += str;
        tool.mkdir(dir);
        dir += 'api/'; tool.mkdir(dir);
        //console.log(req.url);//?? 如何获取 form表单的来源者
        fs.writeFileSync(dir+tool.date('YMDHis')+'_PostJs.json',str);
    }
    //console.log(req.bind);
    res.write(html);
}